from gibe.plugin import Plugin
import cherrypy
from widgets import OpenIDDelegationWidget

class OpenIDDelegationPlugin(Plugin):
    def __init__(self):
        self.reconfigure()

    def reconfigure(self):
        conf = dict(
            openid_server = cherrypy.config.get("openid.server", None),
            openid_delegate = cherrypy.config.get("openid.delegate", None),
            openid2_local_id = cherrypy.config.get("openid2.local_id", None),
            openid2_provider = cherrypy.config.get("openid2.provider", None),
            xrds_location = cherrypy.config.get("xrds.location", None),
        )

        self.w = OpenIDDelegationWidget(**conf)

    def blog_header_widgets(self, blog, wl, context):
        wl.extend([self.w])
        print wl
